<?php 
require_once("connect_db.php");
$sql="select meet_datetime,meet_hour from meeting where meet_id='".$_GET["temp"]."'";
$query=mysql_query($sql);
$result=mysql_fetch_array($query);
$more=date('Y-m-d H:i:s',strtotime($result["meet_datetime"]. '+'.$result["meet_hour"].' hour'));
$sqlTeacher="select car.car_id from car,meeting where meet_datetime>='".$result["meet_datetime"]."' and meet_datetime<='".$more."' and car.car_id=meeting.car_id and status='Y'";
$queryTeacher=mysql_query($sqlTeacher);
$conn="";
while($rchk=mysql_fetch_array($queryTeacher)){
$conn.=" and car_id!='".$rchk["car_id"]."'";
}
$i=0;

$sqlTeacher2="select * from car where 1=1 ".$conn." and status='Y'";
$queryTeacher2=mysql_query($sqlTeacher2);
while($row = mysql_fetch_array($queryTeacher2))
{ 
$arr["text"]=$row["car_brand"]." ".$row["car_model"];
$arr["value"]=$row["car_id"];
$arr["selected"]=false;
if($row["car_geartype"]=="อัตโนมัติ")
$arr["description"]="เกียร์ : ออโต้";
else 
$arr["description"]="เกียร์ : ธรรมดา";
$arr["imageSrc"]="../uploads/car/pics/".$row["car_pic"];
$main_arr[] = $arr;
$i++;
}

$json = json_encode($main_arr);
echo $json;
?>